// localStorage.length：获取key-value对的数目;
//  localStorage.key(index)：获取第index索引的key;
//  localStorage.getItem(key)：获取指定key对应的value;
//  localStorage.setItem(key,value)：保存指定的key-value对;
//  localStorage.removeItem(key)：删除指定key对应的key-value对;
//  localStorage.clear()：删除所有key-value对

//例:dui对访问页面进行计数
<script type="text/javascript">
    if (localStorage.pagecount)
    {
    localStorage.pagecount=Number(localStorage.pagecount) +1;
    }
    else
    {
    localStorage.pagecount=1;
    }
    document.write("Visits "+ localStorage.pagecount + " time(s).");
</script>

//localStorage永久存储
//sessionStorage关闭浏览器消失且有固定域限制